package com.viu.technology.controller;

import com.viu.technology.service.async.AsyncService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/async")
public class AsyncController {

    private static Logger log = LoggerFactory.getLogger(AsyncController.class);

    @Autowired
    AsyncService asyncService;


    @GetMapping("/testAsync")
    public String testAsync() {
        log.info("Controller Start!");
        try {
            asyncService.executeAsync();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "运行结束";
    }
}
